package main;

import javax.swing.JFrame;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;

public class Test_graph {
	public static void main(String[] args) {
		/* Step - 1: Define the data for the line chart  */
        DefaultCategoryDataset line_chart_dataset = new DefaultCategoryDataset();
        line_chart_dataset.addValue(15, "schools", "1970");
        line_chart_dataset.addValue(30, "schools", "1980");
        line_chart_dataset.addValue(60, "schools", "1990");
        line_chart_dataset.addValue(120, "schools", "2000");
        line_chart_dataset.addValue(240, "schools", "2010");
        
        
        line_chart_dataset.addValue(80, "age", "1970");
        line_chart_dataset.addValue(65, "age", "1980");
        line_chart_dataset.addValue(24, "age", "1990");
        line_chart_dataset.addValue(12, "age", "2000");
        line_chart_dataset.addValue(110, "age", "2010");
        
        /* Step -2:Define the JFreeChart object to create line chart */
        JFreeChart lineChartObject=ChartFactory.createLineChart("Schools Vs Years","Year","Schools Count",line_chart_dataset,PlotOrientation.VERTICAL,true,true,false);                
	 
	    //create and display a frame...
        ChartPanel panel= new ChartPanel(lineChartObject);
	    
        JFrame frame = new JFrame();
        frame.setContentPane(panel);
        frame.pack();
	    frame.setVisible(true);
	}
}
